package com.wzp.fulfill.infrastructure.gatewayimpl;

import com.wzp.fulfill.domain.event.OrderFulfillDeniedEvent;
import com.wzp.fulfill.domain.event.OrderInterceptedEvent;
import com.wzp.fulfill.domain.gateway.DomainEventGateway;
import com.wzp.fulfill.infrastructure.gatewayimpl.mq.RocketMQProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DomainEventGatewayImpl implements DomainEventGateway {

    @Autowired
    private RocketMQProducer rocketMQProducer;

    @Override
    public void publishOrderInterceptedEvent(OrderInterceptedEvent orderInterceptedEvent) {
        // 我们在这里需要把订单被拦截的事件，转换为对应的mq message消息
        String message = null;
        rocketMQProducer.sendMessage("OrderInterceptedEventTopic", message);
    }

    @Override
    public void publishOrderFulfillDeniedEvent(OrderFulfillDeniedEvent orderFulfillDeniedEvent) {

    }

}
